package cn.jingzhuan.fm.network

import cn.jingzhuan.fm.network.json.JsonResponse
import cn.jingzhuan.fm.pojo.*
import io.reactivex.Flowable
import retrofit2.http.*

interface FMApiService {

    @GET("/app/fm/v1/banner/lists")
    fun bannerList(): Flowable<JsonResponse<List<ADBanner>>>

    @GET("/app/fm/v1/album/listen-today")
    fun todayListenList():Flowable<JsonResponse<List<AlbumTodayListen>>>

    @GET("/app/fm/v1/album/recommend")
    fun albumRecommendList(): Flowable<JsonResponse<List<FMAlbum>>>

    @GET("/app/fm/v1/audio/lists")
    fun audioList(@Query("page") page: Int,
                  @Query("limit") limit: Int,
                  @Query("is_reverse") isReverse: Int,
                  @Query("album_id") albumId: String
    ): Flowable<JsonResponse<List<FMAudio>>>

    @GET("/app/fm/v1/audio/listen")
    fun audioListen(@Query("audio_id") audioId:String): Flowable<JsonResponse<FMAudio>>

    @GET("/app/fm/v1/album/find")
    fun albumFind(@Query("album_id") albumId: String): Flowable<JsonResponse<FMAlbum>>

    @GET("/app/fm/v1/article/find")
    fun articleFind(@Query("audio_id") audioId: String): Flowable<JsonResponse<FMArticle>>

    @GET("/app/fm/v1/audio/comment/lists")
    fun audioCommentList(@Query("page") page:Int,
                         @Query("limit") limit:Int,
                         @Query("audio_id") audioId:String): Flowable<JsonResponse<List<FMAudioComment>>>

    @FormUrlEncoded
    @POST("/app/fm/v1/audio/comment/post")
    fun audioCommentSend(@Field("audio_id") audioId: String,
                           @Field("content") content:String,
                           @Field("reply_audio_comment_id") replyAudioCommentId: String): Flowable<JsonResponse<String>>


    @POST("/app/fm/v1/audio/comment/like")
    fun audioCommentLike(@Field("audio_comment_id") audioCommentId: String): Flowable<JsonResponse<String>>

}